<?php
defined('IN_ADMIN') or exit('No permission resources.');
include PC_PATH.'modules'.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.'header.tpl.php';
?>
<?php
	$this->au = pc_base::load_model('admin_model');
	$auarr=$this->au->get_one(array('username'=>$admin_username));
	$tyarr=string2array($auarr['type']);
	$this->db = pc_base::load_model('content_model');
	
	$this->ty = pc_base::load_model('type_model');
	//$tyarr=$this->ty->select(array('module'=>'content'));
	//$typearr=string2array($info['type']);
	if($auarr['type']){
		foreach($tyarr as $k=>$r){
			$cn=$this->ty->get_one(array('typeid'=>$r));
			if($k==0){
				$c.=$cn[name];
			}else{
				$c.="- ".$cn[name];
			}
		}
	}else{
		$c="所有权限";
	}
?>

<div id="main_frameid" class="pad-10 display" style="_margin-right:-12px;_width:98.9%;">
<script type="text/javascript">
$(function(){if ($.browser.msie && parseInt($.browser.version) < 7) $('#browserVersionAlert').show();}); 
</script>
<div class="explain-col mb10" style="display:none" id="browserVersionAlert">
<?php echo L('ie8_tip')?></div>
<div class="col-2 col-auto">
	<h6><?php echo L('personal_information')?></h6>
	<div class="content">
	<?php echo L('main_hello')?><?php echo $admin_username?>&nbsp;&nbsp;
	<?php echo L('main_role')?><?php echo $rolename?>&nbsp;&nbsp;
    管理权限：<?php echo $c; ?>
    
    <br />
    <div class="bk20 hr"><hr /></div>
    <?php
	$CATEGORYS = getcache('category_content_1','commons');
	$stime = mktime(0,0,0,date("m",time()),date("d",time()),date("Y",time()));
	if($auarr['type']){
		foreach($tyarr as $r){
			$tinfo=$this->ty->get_one(array('typeid'=>$r));
			echo "【$tinfo[name]总】";
			foreach($CATEGORYS as $v){
				$this->db->set_model($v[modelid]);
				$t=$this->db->count(array('typeid'=>$r));
				echo $v[catname].":".$t."条&nbsp;&nbsp;";
			}
			
			echo "<br>【$tinfo[name]今】";
			foreach($CATEGORYS as $v){
				$this->db->set_model($v[modelid]);
				$t=$this->db->count("typeid=$r and inputtime>$stime");
				echo $v[catname].":".$t."条&nbsp;&nbsp;";
			}
		}
		
	}else{
		echo "【总】";
		foreach($CATEGORYS as $r){
			$this->db->set_model($r[modelid]);
			$t=$this->db->count();
			echo $r[catname].":".$t."条&nbsp;&nbsp;";
		}
		echo "<br>【今】";
		
		foreach($CATEGORYS as $r){
			$this->db->set_model($r[modelid]);
			$t=$this->db->count("inputtime>$stime");
			echo $r[catname].":".$t."条&nbsp;&nbsp;";
		}
	}
	?>
	<div class="bk20 hr"><hr /></div>
	<?php echo L('main_last_logintime')?><?php echo date('Y-m-d H:i:s',$logintime)?> 
	<?php echo L('main_last_loginip')?><?php echo $loginip?> <br />
    
	</div>
</div>

<div class="bk10"></div>

<div class="col-2 col-auto">
	<h6><?php echo L('main_sysinfo')?></h6>
	<div class="content">
	<?php echo L('main_version')?>Phpcms <?php echo PC_VERSION?>  Release <?php echo PC_RELEASE?> [<a href="http://download.phpcms.cn/v9/" target="_blank"><?php echo L('main_latest_version')?></a>]<br />
	<?php echo L('main_os')?><?php echo $sysinfo['os']?> <br />
	<?php echo L('main_web_server')?><?php echo $sysinfo['web_server']?> <br />
	<?php echo L('main_sql_version')?><?php echo $sysinfo['mysqlv']?><br />
	<?php echo L('main_upload_limit')?><?php echo $sysinfo['fileupload']?><br />	
	</div>
</div>
<div class="bk10"></div>

</div>
</body></html>